home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / commercial / visual_inspirations / mlm / rexx / ppagemailmerge.rexx < prev   
OS/2 REXX Batch file  |  1994-11-17  |  4KB  |  162 lines

  1. /*
  2.                             PPageMailMerge.Rexx
  3.                            Written By J.L. White
  4.                         (C) 1993 Merlin's Software
  5.  
  6.            For Use With Mailing List Manager & Professional Page
  7.                        Use Mail Merge From Database
  8. */
  9.  
  10. CR = '0a'x
  11. arg CurrentFile Total
  12. call SetUp
  13. if CurrentFile == 1 then do
  14.     call ppm_PPageToFront()
  15.     call PickPrint
  16.     call ppm_PPageToBack()
  17.     end
  18. else call CheckSettings
  19. call GetData
  20. call MergeData
  21. call PrintIt
  22. call ppm_PPageToBack()
  23. if CurrentFile = Total then address command "Delete >NIL: RAM:Info.Temp"
  24. exit
  25.  
  26. SetUp:
  27.     FileName = "RAM:MLM.Temp"
  28.     MergePage = "MLM:Rexx/MailMerge.PPage"
  29.     ppm_LoadDocument(MergePage,1,0)
  30. return
  31.  
  32. GetData:
  33.     call open MergeData,"RAM:MLM.Temp",'R'
  34.     Address1 = strip(readln(MergeData))
  35.     Address2 = strip(readln(MergeData))
  36.     Address3 = strip(readln(MergeData))
  37.     Address4 = strip(readln(MergeData))
  38.     LabelA =  strip(readln(MergeData))
  39.     LabelB =  strip(readln(MergeData))
  40.     LabelC =  strip(readln(MergeData))
  41.     LabelD =  strip(readln(MergeData))
  42.     LabelE =  strip(readln(MergeData))
  43.     LabelF =  strip(readln(MergeData))
  44.     LabelG =  strip(readln(MergeData))
  45.     LabelH =  strip(readln(MergeData))
  46.     LabelI =  strip(readln(MergeData))
  47.     LabelJ =  strip(readln(MergeData))
  48.     call close MergeData
  49. return
  50.  
  51. MergeData:
  52.     ppm_SetEdit("MergeBox")
  53.     ppm_Replace("<A>",LabelA,0,1,1,0)
  54.     ppm_SetEdit("MergeBox")
  55.     ppm_Replace("<B>",LabelB,0,1,1,0)
  56.     ppm_SetEdit("MergeBox")
  57.     ppm_Replace("<C>",LabelC,0,1,1,0)
  58.     ppm_SetEdit("MergeBox")
  59.     ppm_Replace("<D>",LabelD,0,1,1,0)
  60.     ppm_SetEdit("MergeBox")
  61.     ppm_Replace("<E>",LabelE,0,1,1,0)
  62.     ppm_SetEdit("MergeBox")
  63.     ppm_Replace("<F>",LabelF,0,1,1,0)
  64.     ppm_SetEdit("MergeBox")
  65.     ppm_Replace("<G>",LabelG,0,1,1,0)
  66.     ppm_SetEdit("MergeBox")
  67.     ppm_Replace("<H>",LabelH,0,1,1,0)
  68.     ppm_SetEdit("MergeBox")
  69.     ppm_Replace("<I>",LabelI,0,1,1,0)
  70.     ppm_SetEdit("MergeBox")
  71.     ppm_Replace("<J>",LabelJ,0,1,1,0)
  72.     ppm_SetEdit("MergeBox")
  73.     ppm_Replace("<1>",Address1,0,1,1,0)
  74.     ppm_SetEdit("MergeBox")
  75.     ppm_Replace("<2>",Address2,0,1,1,0)
  76.     ppm_SetEdit("MergeBox")
  77.     ppm_Replace("<3>",Address3,0,1,1,0)
  78.     ppm_SetEdit("MergeBox")
  79.     ppm_Replace("<4>",Address4,0,1,1,0)
  80.     call ppm_EndEdit()
  81. return
  82.  
  83. PickPrint:
  84.     TypePrint=ppm_Inform(2,"Postscript Or Preference Printer","PREFERENCE PRINTER","POSTSCRIPT")
  85.     if TypePrint = 1 then call PostPrint
  86.     if TypePrint = 0 then call PrefPrint
  87.     call open InfoData,"RAM:Info.Temp",'W'
  88.     call writeln InfoData,TypePrint
  89.     call writeln InfoData,TypeOutPut
  90.     call writeln InfoData,Manual
  91.     call writeln InfoData,NumCopy
  92.     call writeln InfoData,Eject
  93.     call writeln InfoData,Density
  94.     call close InfoData
  95. return
  96.  
  97. PostPrint:
  98.     OutPut = ppm_Inform(3,"Select Type Of Output To Use?","DISK","SER:","PAR:");
  99.     if OutPut = 2 then TypeOutPut = "PAR:"
  100.     if OutPut = 1 then TypeOutPut = "SER:"
  101.     if OutPut = 0 then do
  102.         TypeOutPut = ppm_GetUserText(50,"Enter Name For Output File!")
  103.         if TypeOutPut = "" then call NoPrint
  104.         TypeOutPut = TypeOutPut
  105.         end
  106.     call ppm_SetPSOutput(TypeOutPut)
  107.     Manual = ppm_Inform(2,"Manual Feed ON-OFF?","OFF","ON")
  108.     call ppm_SetPSManFeed(Manual)
  109.     NumCopy =  ppm_GetUserText(3,"Enter # Of Copies To Print!")
  110.     if NumCopy < 1 then call NoPrint
  111. return
  112.  
  113.  
  114. PrefPrint:
  115.     Eject=ppm_Inform(2,"Eject Page ON-OFF?","OFF","ON")
  116.     call ppm_SetDMEject(Eject)
  117.     Text = "4"cr"1"cr"2"cr"3"cr"5"cr"6"cr"7"
  118.     Density = value(ppm_SelectFromList(" Select Density",1,7,0,Text))
  119.     if Density < 1 then call NoPrint
  120.     call ppm_SetDMDensity(Density)
  121.     NumCopy =  ppm_GetUserText(3,"Enter # Of Copies To Print!")
  122.     if NumCopy < 1 then call NoPrint
  123.     
  124. return
  125.  
  126. NoPrint:
  127.     ppm_Inform(1,"Printing Has Been Cancelled!","OK")
  128.     call ppm_PPageToBack()
  129.     address command "Delete >NIL: RAM:Info.Temp"
  130.     call ppm_New()
  131.     exit
  132. return
  133.  
  134. CheckSettings:
  135.     call open InfoData,"RAM:Info.Temp",'R'
  136.     TypePrint = readln(InfoData)
  137.     TypeOutPut = readln(InfoData)"."CurrentFile
  138.     Manual = readln(InfoData)
  139.     NumCopy = readln(InfoData)
  140.     Eject = readln(InfoData)
  141.     Density = readln(InfoData)
  142.     call close InfoData
  143.     if TypePrint = 1 then do
  144.         call ppm_SetPSOutput(TypeOutPut)
  145.         call ppm_SetPSManFeed(Manual)
  146.     end
  147.     if TypePrint = 0 then do
  148.         call ppm_SetDMEject(Eject)
  149.         call ppm_SetDMDensity(Density)
  150.     end
  151.  
  152. return
  153.  
  154. PrintIt:
  155.     if TypePrint = 1 then call ppm_PrintDocPS(NumCopy,1)
  156.     if TypePrint = 0 then call ppm_PrintDocDM(NumCopy,1)
  157. return
  158.  
  159.  
  160.  
  161.  
  162.